////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2008 Michiel Helvensteijn                                    //
//                                                                            //
// This file is part of the Mist compiler.                                    //
//                                                                            //
// The Mist compiler is free software: you can redistribute it and/or modif   //
// it under the terms of the GNU General Public License as published by       //
// the Free Software Foundation, either version 3 of the License, or          //
// (at your option) any later version.                                        //
//                                                                            //
// The Mist compiler is distributed in the hope that it will be useful,       //
// but WITHOUT ANY WARRANTY; without even the implied warranty of             //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              //
// GNU General Public License for more details.                               //
//                                                                            //
// You should have received a copy of the GNU General Public License          //
// along with the Mist compiler.  If not, see <http://www.gnu.org/licenses/>. //
////////////////////////////////////////////////////////////////////////////////

#ifndef ACCESSTYPE_HPP
#define ACCESSTYPE_HPP

/******************************************************************************
 * Includes                                                                   *
 ******************************************************************************/

#include <string>
using std::string;

#include <boost/operators.hpp>
using boost::equality_comparable;

/******************************************************************************
 * AccessType Enum                                                            *
 ******************************************************************************/

class AccessLevel : public equality_comparable<AccessLevel> {
	public:
		
		AccessLevel() {}
		AccessLevel(bool r, bool w) : readable(r), writable(w) {}
		
		bool operator==(const AccessLevel& other) const;
		
		bool readable;
		bool writable;
};

class AccessType : public equality_comparable<AccessType> {
	public:
		
		AccessType() {}
		AccessType(bool ir, bool iw, bool vr, bool vw) : identity(ir, iw), value(vr, vw) {}
		
		bool operator==(const AccessType& other) const;
		
		AccessLevel identity;
		AccessLevel value;
};

/******************************************************************************
 * Convenience Functions                                                      *
 ******************************************************************************/

string to_string(AccessType accessType);

#endif // ACCESSTYPE_HPP
